// 初始化
function applyRoomList() {
    $(".form-roomlist").jQValidator({
        isClearForm: false,
        excluded: ':disabled',
        fields: {
            applyBydate: {
                validators: {
                    notEmpty: {
                        message: '请填写您的预约日期'
                    }
                }
            },
            applyClassify: {
                validators: {
                    notEmpty: {
                        message: '请填写您的预约时间'
                    }
                }
            },
            applyName: {
                validators: {
                    notEmpty: {
                        message: '请填写您的姓名'
                    },
                }
            },
            applyTel: {
                validators: {
                    notEmpty: {
                        message: '请填写您的移动电话'
                    },
                    phone: {
                        phoneType: 'MB'
                    }
                }
            },
            applyVcode: {
                validators: {
                    notEmpty: {
                        message: '请填写验证码'
                    },
                }
            },
            applyRead: {
                validators: {
                    notEmpty: {
                        message: '请选择阅读'
                    },
                }
            },
        }
    });
}

$('.btn-hrapply').on(tap, function() {
    $('#modalHrbox').modal('show');
});
// $('#modalHrbox').on('shown.bs.modal', function() {
//     applyForm();
// })
$(window).on("load", function() {
    applyRoomList();
});

// 表单关闭
$('.hr-pop .close').on('click', function() {
    $('.hr-pop').hide()
})

// 表单提交
$('.form-roomlist .btn-submit').on('click', function() {
    /// 点击提交按钮进行校验
    var isValid;
    var jQValidator = $(".form-roomlist").data('jQValidator');
    jQValidator.validate();

    /// bool, 所有字段验证是否正确
    var isValid = $('.form-roomlist').data('jQValidator').isValid();

    if (isValid) {
        // TipsSucShow()
        // console.log(1);
        $('.hr-pop.win').show()

    } else {
        // $('.hr-pop.lose').show()
    }
});